Learn R Programming

SpatialNP (version 1.1-5)

Shape matrices: Shape matrices based on spatial ranks and signed ranks

Description

Iterative algorithms to find shape matrices based on spatial signs and ranks and the k-step versions of these.

Usage

spatial.shape(X, score = c("sign", "symmsign", "rank", "signrank"), 
fixed.loc = FALSE, location = NULL, init = NULL, steps = Inf, 
eps = 1e-06, maxiter = 100, na.action = na.fail)

signs.shape(X, fixed.loc = FALSE, location = NULL, init = NULL, steps = Inf, eps = 1e-6, maxiter = 100, na.action = na.fail)

symmsign.shape(X, init = NULL, steps = Inf, eps = 1e-6, maxiter = 100, na.action = na.fail)

symmsign.shape.inc(X, m=10, init=NULL, steps=Inf, permute=TRUE, eps=1e-6, maxiter=100, na.action=na.fail)

rank.shape(X, init = NULL, steps = Inf, eps = 1e-06, maxiter = 100, na.action = na.fail)

signrank.shape(X, fixed.loc = FALSE, location = NULL, init = NULL, steps = Inf, eps = 1e-06, maxiter = 100, na.action = na.fail)

Arguments

X

a matrix or a data frame

score

a character string indicating which transformation of the observations should be used

fixed.loc

a logical, see details

location

an optional vector giving the location of the data or the initial value for the location if it is estimated

init

an optional starting value for the iteration

steps

fixed number of iteration steps to take, if Inf iteration is repeated until convergence (or until maxiter steps)

m

a parameter in symmsign.shape.inc which defines how many pairwise differences are used, see details

permute

logical in symmsign.shape.inc which determines whether the rows of X are permuted randomly, see details.

eps

tolerance for convergence

maxiter

maximum number of iteration steps. Ignored if steps is finite

na.action

a function which indicates what should happen when the data contain 'NA's. Default is to fail.

Value

The estimate matrix with the (final estimate of or given) location vector as attribute "location".

Details

sign.shape is Tyler's shape matrix and symmsign.shape is Duembgen's shape matrix. Function symmsign.shape.inc is for a computationally lighter estimator to approximate Duembgen's shape matrix. Only a subset of the pairwise differences are used in the computation in the incomplete case. The magnitude of the subset used is controlled by the argument m which is half of the number of how many differences each observation is part of. Differences of successive observations are used, and therefore random permutation of the rows of X is suggested and is the default choice in the function. For details see Miettinen et al., 2016. rank.shape and signrank.shape are the so called inner standardization matrices of location etc. tests based on spatial signs and ranks. When data is standardized using these matrices the corresponding sign or rank scores will appear “uncorrelated”: the corresponding outer standardization matrices will be proportional to the identity matrix, see examples.

spatial.shape is a wrapper function for a unified access to all four shape estimates (not including symmsign.shape.inc). The choice of estimate is done via score:

  • "sign" for signs.shape

  • "symmsign" for symmsign.shape

  • "rank" for rank.shape

  • "signrank" for signrank.shape

signrank.shape and sign.shape include options to compute the shape matrix either with respect to fixed location (fixed.loc = TRUE) or so that the location and the shape are estimated simultaneously (fixed.loc = FALSE).

References

Oja, H., Randles R. (2004) Multivariate Nonparametric Tests. Statistical Science 19, 598-605.

Sirkia et al. (2009) Tests and estimates of shape based on spatial signs and ranks. Journal of Nonparametric Statistics, 21, 155-176.

Sirkia, S., Taskinen, S., Oja, H. (2007) Symmetrised M-estimators of scatter. Journal of Multivariate Analysis, 98, 1611-1629.

Miettinen, J., Nordhausen, K., Taskinen, S., Tyler, D.E. (2016) On the computation of symmetrized M-estimators of scatter. In Agostinelli, C. Basu, A., Filzmoser, P. and Mukherje, D. (editors) ''Recent Advances in Robust Statistics: Theory and Application'', 131-149, Springer India, New Delhi.

See Also

tyler.shape, duembgen.shape, also spatial sign and rank covariance matrices and spatial signs and ranks

Examples

Run this code
# NOT RUN {
A<-matrix(c(1,2,-3,4,3,-2,-1,0,4),ncol=3)
X<-matrix(rnorm(1500),ncol=3)%*%t(A)
symmsign.shape(X)
to.shape(symmsign.shape(X),trace=3)
spatial.shape(X,score="sign")
spatial.shape(X,score="sign",fixed.loc=TRUE)
to.shape(A%*%t(A))
# one-step shape estimate based on spatial ranks and covariance matrix:
spatial.shape(X,score="rank",init=cov(X),steps=1)
symmsign.shape.inc(X, m=5)
# }

Run the code above in your browser using DataLab